home *** CD-ROM | disk | FTP | other *** search
/ Sound Galaxy Audio Applications & Utilities / Sound Galaxy Audio Applications & Utilities.iso / PMMSETUP.MST < prev    next >
Encoding:
Text File  |  1994-03-23  |  19.4 KB  |  739 lines

  1. '**************************************************************************
  2. '*                     Professor MULTIMEDIA Setup Script
  3. '**************************************************************************
  4.  
  5. '' Define DEBUG for script debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST WELCOME      = 100
  12. CONST NODSPACE     = 101
  13. CONST ASKQUIT      = 200
  14. CONST DESTPATH     = 300
  15. CONST EXITFAILURE  = 400
  16. CONST EXITQUIT     = 600
  17. CONST EXITSUCCESS  = 700
  18. CONST WHICHINST    = 800
  19. CONST APPHELP      = 900
  20. CONST WHICHINSTHLP = 910
  21. CONST TESTSOUND    = 1100
  22. CONST INSTALLDRV   = 1200
  23. CONST SOUNDPLAYED  = 1300
  24. CONST WAITDLG      = 1400
  25. CONST EXITREBOOT   = 1500
  26. CONST BBD1         = 5000
  27. CONST BBD6         = 5050
  28. CONST SOUNDSDLG    = 5200
  29. CONST CUSTINST     = 6200
  30. CONST TOOBIG       = 6300
  31. CONST BADPATH      = 6400
  32.  
  33. '' For message boxes
  34. CONST MB_YESNO=4
  35. CONST IDNO=7
  36. CONST IDYES=6
  37.  
  38. ''Bitmap ID
  39. CONST LOGO         = 1
  40.  
  41. ''File Types
  42. CONST BASEFILES     = 1
  43. CONST SOUNDFILES    = 3
  44.  
  45. ''Install directories, etc.
  46. GLOBAL DEST$        ''Default destination directory.
  47. GLOBAL WINDRIVE$    ''Windows drive letter.
  48. GLOBAL CUIDLL$      ''CUI DLL
  49. GLOBAL WINDIR$      ''Windows directory
  50. GLOBAL SYSDIR$      ''System directory
  51. GLOBAL WININI$      ''"win.ini"
  52. GLOBAL SYSINI$      ''GetWindowsDir() + "system.ini"
  53. GLOBAL CDDRV$       ''EUB - CDROM drive root directory
  54.  
  55. ''Install item lists
  56. GLOBAL BASE$        ''List of base files
  57. GLOBAL SOUNDS$      ''List of all sounds.
  58.  
  59. GLOBAL BASEINST$    ''List of base files to install (subset of BASE$)
  60. GLOBAL SOUNDSINST$  ''List of sounds to install (subset of SOUNDS$)
  61.  
  62. ''Custom Install list symbol names
  63. GLOBAL BASENEEDS$   ''Option list costs per drive
  64. GLOBAL SOUNDNEEDS$
  65. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  66.  
  67. ''Custom Install dialog list symbol names
  68. GLOBAL CHECKSTATES$ ''List of check box values
  69. GLOBAL STATUSTEXT$  ''List of values to initialize status items
  70. GLOBAL DRIVETEXT$   ''Drive space info, etc.
  71.  
  72. '' Install DSOUND
  73. GLOBAL INSTDSOUND%
  74.  
  75. '' Customize product
  76. GLOBAL CUSTOMIZE%
  77.  
  78. '' Test sound hardware
  79. GLOBAL DOTEST%
  80.  
  81. GLOBAL PMMFOUND%
  82. GLOBAL CUSTINSTALL%
  83.  
  84. '' Which type of install to perform, by default
  85. GLOBAL DEFINSTOPT$
  86.  
  87. ''Progman titles
  88. GLOBAL PMMAPP$      ''Name of PMM app
  89.  
  90. ''Win.ini [ProfMultiMedia] install code
  91. GLOBAL INSTDIR$
  92.  
  93. ''Space requirements
  94. GLOBAL FITS%        '' > 0 if everything fits
  95.  
  96. DECLARE SUB RecalcOptFiles (ftype%)
  97. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  98. DECLARE FUNCTION GetWindowsVersionCorrectly& ()
  99. DECLARE FUNCTION MakeVer& (x as integer, y as integer)
  100. DECLARE FUNCTION StringInList (s$, y$) AS INTEGER
  101. DECLARE FUNCTION sndPlaySound LIB "MMSYSTEM.DLL" (f$, fl%) AS INTEGER
  102. DECLARE SUB RemoveSectionFiles (dest$, sect$)
  103. DECLARE SUB RemDirectory (d$)
  104. DECLARE FUNCTION HasSoundDriver() AS INTEGER
  105. DECLARE SUB SendProgmanCommand LIB "CUI.DLL" (s$)
  106.  
  107. '' These are defined in wsf.inc (product-specific)
  108. DECLARE SUB SetProductTitles
  109. DECLARE FUNCTION InfFile() AS STRING
  110. DECLARE FUNCTION MakeInstDir(D$) AS STRING
  111. DECLARE SUB AddInfSectionNames (BASE$, SOUNDS$, BASEINST$, SOUNDSINST$)
  112. DECLARE SUB RecalcPath
  113. DECLARE SUB AddOptFilesToCopyList (ftype%)
  114. DECLARE SUB SetDriveStatus
  115. DECLARE SUB AddOptFiles
  116. DECLARE SUB ConfigureApps
  117. DECLARE SUB AddBillboards
  118. DECLARE SUB DoUninstall
  119.  
  120.  
  121. '' This is where it all begins!
  122.  
  123. INIT:
  124.  
  125.     CUIDLL$ = "cui.dll"
  126.     DEFINSTOPT$ = "2"       '' "1" = 1st radiobutton selection, "2"=2nd, "3"=3rd
  127.     INSTDSOUND% = 0
  128.     CUSTOMIZE% = -1
  129.     DOTEST% = -1
  130.     CDDRV$ = GetSymbolValue("STF_SRCDIR")   ''EUB - Intallation drive root directory
  131. '-- CDDRV$ = MID$(CDDRV$,1,2) + "\MAINMENU\"   ''EUB - get the drive string + set dir
  132.  
  133.     SetProductTitles
  134.  
  135.     HELPPROC$ = "FHelpDlgProc"      ''Help dialog procedure
  136.  
  137.     SetBitmap CUIDLL$, LOGO
  138.  
  139.  
  140. '' We don't do Windows 3.0...
  141.  
  142.     If GetWindowsVersionCorrectly() < MakeVer(3, 10) Then
  143.     i% = DoMsgBox("This product requires Windows version 3.10 or greater", PMMAPP$, MB_OK)
  144.     GOTO DONEFINIFIN
  145.     End If
  146.  
  147. ''Find location of INF file and create a default dest. dir
  148.  
  149.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  150.     IF szInf$ = "" THEN
  151.         szInf$ = GetSymbolValue("STF_CWDDIR") + InfFile()
  152.     END IF
  153.  
  154.     '' Load the INF file
  155.     ReadInfFile szInf$
  156.  
  157.     '' Construct default strings
  158.     WINDIR$ = GetWindowsDir()
  159.     SYSDIR$ = GetWindowsSysDir()
  160.     WININI$ = "win.ini"
  161.     SYSINI$ = MakePath(WINDIR$, "system.ini")
  162.  
  163.     '' Construct the default install path
  164.     WINDRIVE$ = MID$(WINDIR$, 1, 1)
  165.     DEST$ = MakeInstDir(WINDRIVE$)
  166. ''----------------------------------------------------------------------
  167. '' We need to install some drivers on the Windows directory, and the TBK
  168. '' files into another drive, if we don't have enough space.  So we better
  169. '' make sure there's enough (NON-COMPRESSED) diskspace available in the
  170. '' Windows directory.  We need about 507 K of diskspace for these drivers,
  171. '' but, let's double this amount, in case the user has DBLSPACE installed
  172. '' in his system.
  173. '' 
  174. CHKDSK:
  175.     free& = GetFreeSpaceForDrive(WINDRIVE$) / 1024
  176. ''i%=DoMsgBox("drive$=" + WINDRIVE$ +" free="+STR$(free&), "Debugging", MB_OK)
  177.  
  178.  
  179.     IF free& < 1024 THEN            ''if free diskspace < 1 megabyte
  180.  
  181.         sz$ = UIStartDlg(CUIDLL$, NODSPACE, "FInfoDlgProc", 0, "")
  182.  
  183.         UIPop 1    
  184.         IF sz$ = "EXIT" THEN
  185.             GOSUB TOOBIG
  186.             END
  187.         ELSEIF sz$ = "CONTINUE" THEN
  188.             GOTO CHKDSK
  189.         END IF
  190.         GOTO CHKDSK
  191.     END IF
  192. ''----------------------------------------------------------------------
  193.     '' Setup install symbols
  194.     BASE$ = "Base Files"
  195.     SOUNDS$ = "Sounds"
  196.     BASEINST$ = "Base Files Inst"
  197.     SOUNDSINST$ = "Sounds Inst"
  198.  
  199.     SetSymbolValue BASE$, ""
  200.     SetSymbolValue SOUNDS$, ""
  201.  
  202.     ''Set up symbols for the initial install dialog
  203.     RADIODEFAULT$ = "Radio Default"
  204.  
  205.     ''Set up symbols for the custom install dialog
  206.     CHECKSTATES$ = "CheckItemsState"
  207.     STATUSTEXT$  = "StatusItemsText"
  208.     DRIVETEXT$   = "DriveStatusText"
  209.     FOR i% = 1 TO 4 STEP 1
  210.         AddListItem CHECKSTATES$, "ON"
  211.     NEXT i%
  212.     FOR i% = 1 TO 4 STEP 1
  213.         AddListItem STATUSTEXT$, ""
  214.     NEXT i%
  215.     FOR i% = 1 TO 7 STEP 1
  216.         AddListItem DRIVETEXT$, ""
  217.     NEXT i%
  218.     ReplaceListItem DRIVETEXT$, 7, DEST$
  219.  
  220.     ''Disk cost list symbols
  221.     BASENEEDS$   = "BaseNeeds"
  222.     SOUNDNEEDS$  = "SoundNeeds"
  223.     EXTRACOSTS$  = "ExtraCosts"
  224.     FOR i% = 1 TO 26 STEP 1
  225.         AddListItem EXTRACOSTS$, "0"
  226.     NEXT i%
  227.  
  228.     '' Locate sounds for install
  229.     INSTSNDDIR$ = MakePath(GetSymbolValue("STF_SRCDIR"), "stup\soundfx")
  230.  
  231.     ''Configure lists of installable files
  232.     AddInfSectionNames BASE$, SOUNDS$, BASEINST$, SOUNDSINST$
  233.  
  234. '$IFDEF DEBUG
  235.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  236. '$ENDIF ''DEBUG
  237.  
  238.  
  239. '' Display Welcome dialog
  240. WELCOME:
  241. ''  res% = sndPlaySound(MakePath(INSTSNDDIR$, "v1.wav"), 3)
  242.  
  243.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  244.     
  245.     IF sz$ = "EXIT" THEN
  246.         GOSUB ASKQUIT
  247.         GOTO WELCOME
  248.     ELSEIF sz$ = "CONTINUE" THEN
  249.         UIPop 1
  250.         GOTO CUSTOMIZE
  251.     END IF
  252.     GOTO WELCOME
  253.  
  254.  
  255. '' See which install user wants
  256. WHICHINST:
  257.  
  258.  
  259. '' Customize the copy of the product
  260. CUSTOMIZE:
  261.     IF NOT CUSTOMIZE% THEN
  262.         GOTO SOUNDTEST
  263.     END IF
  264.  
  265.  
  266. '' Test the sound system
  267. SOUNDTEST:
  268.     IF NOT DOTEST% THEN
  269.         GOTO DOINST
  270.     END IF
  271.  
  272.     sz$ = UIStartDlg(CUIDLL$, TESTSOUND, "FInfoDlgProc", WHICHINSTHLP, HELPPROC$)
  273.  
  274.     IF sz$ = "EXIT" THEN
  275.         GOSUB ASKQUIT
  276.         GOTO SOUNDTEST
  277.     ELSEIF sz$ = "CONTINUE" THEN
  278.         UIPop 1
  279.         IF HasSoundDriver() THEN
  280.             GOTO DOINST
  281.         ELSE
  282.             GOTO INSTDSOUND
  283.         END IF
  284.     ELSEIF sz$ = "TEST" THEN
  285.         w$ = MakePath(INSTSNDDIR$, "test123.wav")
  286.         res% = sndPlaySound(w$, 2)
  287.         UIPop 1
  288.         GOTO DIDPLAY
  289.     END IF
  290.     GOTO SOUNDTEST
  291.  
  292.  
  293. '' Did the sound play?
  294. DIDPLAY:
  295.     sz$ = UIStartDlg(CUIDLL$, SOUNDPLAYED, "FInfoDlgProc", WHICHINSTHLP, HELPPROC$)
  296.  
  297.     IF sz$ = "EXIT" THEN
  298.         GOSUB ASKQUIT
  299.         GOTO DIDPLAY
  300.     ELSEIF sz$ = "YES" THEN
  301.         UIPop 1
  302.         GOTO DOINST
  303.     ELSEIF sz$ = "NO" THEN
  304.         UIPop 1
  305.         GOTO INSTDSOUND
  306.     ELSEIF sz$ = "BACK" THEN
  307.         UIPop 1
  308.         GOTO SOUNDTEST
  309.     END IF
  310.     GOTO DIDPLAY
  311.  
  312.  
  313. '' Install DSOUND
  314. INSTDSOUND:
  315.     sz$ = UIStartDlg(CUIDLL$, INSTALLDRV, "FInfoDlgProc", WHICHINSTHLP, HELPPROC$)
  316.  
  317.     IF sz$ = "EXIT" THEN
  318.         GOSUB ASKQUIT
  319.         GOTO INSTDSOUND
  320. ''--ELSEIF sz$ = "INSTALL" THEN
  321. ''      UIPop 1
  322. ''      INSTDSOUND% = -1
  323. ''      GOTO DOINST
  324. ''  ELSEIF sz$ = "CONTINUE" THEN
  325. ''      UIPop 1
  326. ''------GOTO DOINST
  327.     ELSEIF sz$ = "BACK" THEN
  328.         UIPop 1
  329.         GOTO DIDPLAY
  330.     END IF
  331.     GOTO INSTDSOUND
  332.  
  333.  
  334. '' Do the appropriate type of install
  335. DOINST:
  336.     IF CUSTINSTALL% THEN
  337.         GOTO CUSTINST
  338.     END IF
  339.     '' else fall-thru
  340.  
  341. ''Perform a default installation (of all files and options)
  342. DEFINST:
  343.     RecalcPath
  344.     SetDriveStatus
  345.  
  346. GETDEFINSTPATH:
  347.     GOSUB GETPATH
  348.  
  349.     IF sz$ = "CONTINUE" THEN
  350.     ''Install only if it will fit.
  351.         IF FITS% > 0 THEN
  352.             GOSUB TOOBIG
  353.             GOTO GETDEFINSTPATH
  354.         END IF
  355.         UIPop 1
  356.         GOTO INSTALL
  357.     ELSEIF sz$ = "BACK" THEN
  358.         GOTO CUSTOMIZE
  359.     END IF
  360.     GOTO GETDEFINSTPATH
  361.  
  362.  
  363. ''Perform a custom installation (let user choose files, etc)
  364. CUSTINST:
  365.     RecalcPath
  366.     SetDriveStatus
  367.  
  368. ''  res% = sndPlaySound(MakePath(INSTSNDDIR$, "v4.wav"), 3)
  369.  
  370. CUSTINSTDLG:
  371.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  372.  
  373.     IF sz$ = "CONTINUE" THEN
  374.     ''Install only if it will fit.
  375.         IF FITS% > 0 THEN
  376.             GOSUB TOOBIG
  377.             GOTO CUSTINSTDLG
  378.         END IF
  379.         UIPop 1
  380.         GOTO INSTALL
  381.     ELSEIF sz$ = "PATH" THEN
  382. ''      res% = sndPlaySound(MakePath(INSTSNDDIR$, "v5.wav"), 3)
  383.         GOSUB GETPATH
  384.         GOTO CUSTINSTDLG
  385.     ELSEIF sz$ = "CHK1" THEN
  386.         RecalcOptFiles BASEFILES
  387.         SetDriveStatus
  388.         GOTO CUSTINSTDLG
  389.     ELSEIF sz$ = "CHK3" THEN
  390.         RecalcOptFiles SOUNDFILES
  391.         SetDriveStatus
  392.         GOTO CUSTINSTDLG
  393.     ELSEIF sz$ = "BTN3" THEN
  394.         GOTO SOUNDFILES
  395.     ELSEIF sz$ = "EXIT" THEN
  396.         GOSUB ASKQUIT
  397.         GOTO CUSTINST
  398.     END IF
  399.     GOTO CUSTINSTDLG
  400.  
  401.  
  402. INSTALL:
  403.     SetRestartDir DEST$
  404.     ClearCopyList
  405.  
  406.     AddOptFiles
  407.  
  408.     AddBillboards
  409.  
  410. BACKLASH:
  411.     IF (MID$(DEST$, (LEN(DEST$)), 1)) = "\" THEN
  412.             DEST$ = MID$(DEST$, 1, (LEN(DEST$)-1))
  413.         GOTO BACKLASH
  414.     END IF
  415.  
  416.  
  417.     CreateDir DEST$, cmoNone
  418.  
  419.     UIPopAll
  420.  
  421.     res% = sndPlaySound(MakePath(INSTSNDDIR$, "v6.wav"), 3)
  422.  
  423.     ''Do the copyn'
  424.     SetCopyGaugePosition 10, 135
  425.     CopyFilesInCopyList
  426.  
  427.     ''Back up SYSTEM.INI and WIN.INI
  428.     CopyFile MakePath(WINDIR$, WININI$), MakePath(WINDIR$, "WIN.BAK"), cmoOverwrite, 0
  429.     CopyFile SYSINI$, MakePath(WINDIR$, "SYSTEM.BAK"), cmoOverwrite, 0
  430.  
  431.     '' Configure the installed applications
  432.     ConfigureApps
  433.  
  434.     ''See if we need to restart Windows to finish installing system files which may be in use
  435.     IF RestartListEmpty() = 0 THEN
  436.     i% = DoMsgBox("Certain system files that Setup needs to install are currently in use." + "  Please close all other applications and press OK.  Setup will exit Windows, install these files, and restart Windows.", PMMAPP$ + " Setup", MB_OK)
  437.     i% = ExitExecRestart()
  438.     END IF
  439.  
  440. QUIT:
  441.     ON ERROR GOTO ERRQUIT
  442.  
  443.     IF ERR = 0 THEN
  444.         res% = sndPlaySound(MakePath(INSTSNDDIR$, "v7.wav"), 3)
  445.         dlg% = EXITREBOOT
  446.     ELSEIF ERR = STFQUIT THEN
  447.         res% = sndPlaySound(MakePath(INSTSNDDIR$, "v8.wav"), 3)
  448.         dlg% = EXITQUIT
  449.     ELSE
  450.  
  451. '$IFNDEF DEBUG
  452.     RESUME NEXT
  453. '$ELSE
  454.     dlg% = EXITFAILURE
  455. '$ENDIF
  456.  
  457.     END IF
  458.  
  459. QUITL1:
  460.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  461. ''  res% = sndPlaySound(MakePath(INSTSNDDIR$, "v9.wav"), 2)
  462. ''  IF sz$ = "REACTIVATE" THEN
  463. ''      GOTO QUITL1
  464. ''  END IF
  465.     UIPop 1
  466.  
  467. DONEFINIFIN:
  468.     END
  469.  
  470. ERRQUIT:
  471.     res% = sndPlaySound(MakePath(INSTSNDDIR$, "v10.wav"), 3)
  472.     i% = DoMsgBox("An error has during installation. Please call Individual Software Customer Service at (800) 331-3313!", "Setup Error", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  473.     END
  474.  
  475.  
  476.  
  477. GETPATH:
  478.     SetSymbolValue "EditTextIn", DEST$
  479.     SetSymbolValue "EditFocus", "END"
  480. GETPATHL1:
  481.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  482.  
  483.     IF sz$ = "CONTINUE" THEN
  484.         olddest$ = DEST$
  485.         DEST$ = GetSymbolValue("EditTextOut")
  486.         ''Validate new path.
  487.  
  488.  
  489.         VALPATH:
  490.         IF (MID$(DEST$, (LEN(DEST$)), 1)) = "\" THEN
  491.             DEST$ = MID$(DEST$, 1, (LEN(DEST$)-1))
  492.             GOTO VALPATH
  493.         END IF
  494.  
  495.         IF IsDriveValid(MID$(DEST$, 1, 1)) = 0 THEN
  496.             i% = DoMsgBox("This is not a valid path. Please enter a different path.", APP$, MB_OK)
  497.             GOTO GETPATHL1
  498.         END IF
  499.  
  500.  
  501.         IF (MID$(DEST$, 2, 1)) <> ":" THEN
  502.             i% = DoMsgBox("This is not a valid path. Please enter a different path.", APP$, MB_OK)
  503.             GOTO GETPATHL1
  504.         END IF
  505.  
  506.         IF NETINSTALL%=0 THEN
  507.           IF IsDriveNetwork(MID$(DEST$, 1, 1)) > 0 THEN
  508.               i% = DoMsgBox("This is network drive. Please enter a different path.", APP$, MB_OK)
  509.               GOTO GETPATHL1
  510.           END IF
  511.         END IF
  512.  
  513.         SetDriveStatus
  514.         IF FITS% > 0 THEN
  515.             GOSUB TOOBIG
  516.             GOTO GETPATHL1
  517.         END IF
  518.  
  519.         IF IsDriveRemovable(DEST$) > 0 THEN
  520.             i% = DoMsgBox("This program must be installed to a hard drive. Please enter a different drive.", APP$, MB_OK)
  521.             GOTO GETPATHL1
  522.         END IF
  523.  
  524.         IF DEST$+"\"=GetWindowsSysDir THEN
  525.             i% = DoMsgBox("This program can not be installed into the Windows directory. Please enter a different path.", APP$, MB_OK)
  526.             GOTO GETPATHL1
  527.         END IF
  528.  
  529.         IF DEST$+"\"=GetWindowsDir THEN
  530.             i% = DoMsgBox("This program can not be installed into the Windows directory. Please enter a different path.", APP$, MB_OK)
  531.             GOTO GETPATHL1
  532.         END IF
  533.  
  534.         UIPop 1
  535.  
  536.  
  537.         ''Truncate display if too long.
  538.         IF LEN(DEST$) > 23 THEN
  539.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  540.         ELSE
  541.             ReplaceListItem DRIVETEXT$, 7, DEST$
  542.         END IF
  543.  
  544.         ''Recalc if path changed.
  545.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  546.             RecalcPath
  547.             SetDriveStatus
  548.         END IF
  549.  
  550.         olddest$ = ""
  551.         RETURN
  552.     ELSEIF sz$ = "EXIT" THEN
  553.         GOSUB ASKQUIT
  554.         GOTO GETPATHL1
  555.     ELSEIF sz$ = "BACK" THEN
  556.         UIPop 1
  557.         RETURN
  558.     END IF
  559.     GOTO GETPATHL1
  560.  
  561.  
  562. SOUNDFILES:
  563.     SetSymbolValue "ListItemsIn", GetSymbolValue(SOUNDS$)
  564.     SetSymbolValue "ListItemsOut", GetSymbolValue(SOUNDSINST$)
  565. SOUNDF:
  566.     sz$ = UIStartDlg(CUIDLL$, SOUNDSDLG, "FMultiDlgProc", APPHELP, HELPPROC$)
  567.  
  568.     IF sz$ = "CONTINUE" THEN
  569.         UIPop 1
  570.         SetSymbolValue SOUNDSINST$, GetSymbolValue("ListItemsOut")
  571.         RecalcOptFiles SOUNDFILES
  572.         SetDriveStatus
  573.         GOTO CUSTINSTDLG
  574.     ELSEIF sz$ = "EXIT" THEN
  575.         GOSUB ASKQUIT
  576.         GOTO SOUNDF
  577.     ELSE '' Back...
  578.         UIPop 1
  579.         GOTO CUSTINSTDLG
  580.     END IF
  581.     GOTO SOUNDF
  582.  
  583. TOOBIG:
  584.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  585.     UIPop 1
  586.     RETURN
  587.  
  588.  
  589.  
  590. BADPATH:
  591.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  592.     UIPop 1
  593.     RETURN
  594.  
  595.  
  596. ASKQUIT:
  597.     res% = sndPlaySound(MakePath(INSTSNDDIR$, "v12.wav"), 3)
  598.  
  599.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  600.  
  601.     IF sz$ = "EXIT" THEN
  602.         UIPopAll
  603.         ERROR STFQUIT
  604. ''- ELSEIF sz$ = "REACTIVATE" THEN
  605. ''----- GOTO ASKQUIT
  606.     ELSE
  607.         UIPop 1
  608.     END IF
  609.     RETURN
  610.  
  611.  
  612. ''Recalculate space based on install options...
  613. SUB RecalcOptFiles (ftype%) STATIC
  614.  
  615.     CursorSave% = ShowWaitCursor()
  616.  
  617.     sz$ = UIStartDlg(CUIDLL$, WAITDLG, "FModelessDlgProc", APPHELP, HELPPROC$)
  618.  
  619.     ClearCopyList
  620.  
  621.     AddOptFilesToCopyList ftype%
  622.  
  623.     fExtra% = 0
  624.     IF ftype% = BASEFILES THEN
  625.         ListSym$ = BASENEEDS$
  626.     IF GetListItem(CHECKSTATES$, BASEFILES) = "ON" THEN
  627.         ''Add extra cost to Windows drive for ini/progman/pointers
  628.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  629.         ReplaceListItem EXTRACOSTS$, ndrive%, "2097152"
  630.         fExtra% = 1
  631.     END IF
  632.     ELSEIF ftype% = SOUNDFILES THEN
  633.         ListSym$ = SOUNDNEEDS$
  634.     END IF
  635.  
  636.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  637.  
  638.     cost& = 0
  639.     FOR i% = 1 TO 26 STEP 1
  640.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  641.     NEXT i%
  642.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  643.  
  644.     IF fExtra% THEN
  645.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  646.     END IF
  647.  
  648.     UIPop 1
  649.  
  650.     RestoreCursor CursorSave%
  651.  
  652.     ListSym$ = ""
  653. END SUB
  654.  
  655.  
  656. ''Make path from dir and szFile; add \  as needed
  657. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  658.     IF szDir$ = "" THEN
  659.         MakePath = szFile$
  660.     ELSEIF szFile$ = "" THEN
  661.         MakePath = szDir$
  662.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  663.         MakePath = szDir$ + szFile$
  664.     ELSE
  665.         MakePath = szDir$ + "\" + szFile$
  666.     END IF
  667. END FUNCTION
  668.  
  669.  
  670. '' Return true if the given string is in the symbol's list
  671. FUNCTION StringInList (s$, y$) STATIC AS INTEGER
  672.     l% = GetListLength(y$)
  673.     FOR i% = 1 TO l
  674.     IF s$ = GetListItem(y$, i%) THEN
  675.         StringInList = -1
  676.         GOTO DONE
  677.     END IF
  678.     NEXT i%
  679.     StringInList = 0
  680. DONE:
  681. END FUNCTION
  682.  
  683.  
  684. ''Get Windows version
  685. FUNCTION GetWindowsVersionCorrectly& () STATIC
  686.     GetWindowsVersionCorrectly = GetWindowsMajorVersion() * 256 + GetWindowsMinorVersion()
  687. END FUNCTION
  688.  
  689.  
  690. '' Turn x, y into a major.minor version long
  691. FUNCTION MakeVer& (x as integer, y as integer) STATIC
  692.     MakeVer = x * 256 + y
  693. END FUNCTION
  694.  
  695.  
  696. '' Remove all files in the given .INF section
  697. SUB RemoveSectionFiles (dest$, sect$) STATIC
  698.     foo$ = "foo"
  699.     MakeListFromSectionFilename foo$, sect$
  700.     l% = GetListLength(foo$)
  701.     FOR i% = 1 TO l% STEP 1
  702.         RemoveFile MakePath(dest$, GetListItem(foo$, i%)), cmoForce
  703.     NEXT i%
  704.     foo$ = ""
  705. END SUB
  706.  
  707.  
  708. '' Remove directory and all files in it, if it exists
  709. SUB RemDirectory(d$) STATIC
  710.     IF Exists(MakePath(d$, "NUL")) THEN
  711.         Kill MakePath(d$, "*.*")
  712.         RmDir d$
  713.     END IF
  714. END SUB
  715.  
  716.  
  717. '' Return True (-1) if the user has a sound driver in the [drivers]
  718. ''  section of win.ini.
  719. FUNCTION HasSoundDriver() STATIC AS INTEGER
  720.     r% = 0
  721.     IF GetIniKeyString(SYSINI$, "drivers", "wave") <> "" THEN
  722.         r% = -1
  723.     ELSEIF GetIniKeyString(SYSINI$, "drivers", "wave1") <> "" THEN
  724.         r% = -1
  725.     ELSEIF GetIniKeyString(SYSINI$, "drivers", "wave2") <> "" THEN
  726.         r% = -1
  727.     ELSEIF GetIniKeyString(SYSINI$, "drivers", "wave3") <> "" THEN
  728.         r% = -1
  729.     ELSEIF GetIniKeyString(SYSINI$, "drivers", "wave4") <> "" THEN
  730.         r% = -1
  731.     ELSEIF GetIniKeyString(SYSINI$, "drivers", "wave5") <> "" THEN
  732.         r% = -1
  733.     END IF
  734.     HasSoundDriver = r%
  735. END FUNCTION
  736.  
  737. '' Include product-specific function definitions
  738. '$INCLUDE 'specific.inc'
  739.